package model;

public class Course {
    private final String name;
    private final String location;
    private final String time;
    private Teacher teacher;

    public Course(String name, String location, String time) {
        this.name = name;
        this.location = location;
        this.time = time;
    }

    public void setTeacher(Teacher teacher) {
        this.teacher = teacher;
    }

    public String getCourseName() {
        return name;
    }

    public void displayInfo() {
        System.out.println("课程: " + name);
        System.out.println("地点: " + location);
        System.out.println("时间: " + time);
        if (teacher != null) {
            System.out.println("教师: " + teacher.getName());
        }
        System.out.println("---");
    }
}